import pymysql

connect = pymysql.connect(host="localhost", port=3306, user="root", password="cxd@949846.com")

# print(connect.get_server_info())
# print(connect.get_host_info())
connect.select_db("mybatis")

cur = connect.cursor()
# cur.execute('create table if not exists test(id int,name varchar(20));')

# 查询语句
cur.execute('select * from test;')
result = cur.fetchall()
for row in result:
    print(row)
    
print(result)
print(cur.fetchall())

# 插入语句
cur.execute('insert into test value(1,"陈晓东");')
connect.commit()

connect.close()
